package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.StrategyCommentQueryObject;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import cn.wolfcode.trip.base.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/strategyComment")
public class StrategyCommentController {
    @Autowired
    private IStrategyCommentService strategyCommentService;
    //查询 攻略
    @RequestMapping("/list")
    public String  list(Model model,@ModelAttribute("qo") StrategyCommentQueryObject qo){
        qo.setOrderBy("sc.createTime desc");
        model.addAttribute("pageInfo", strategyCommentService.list(qo));
        return "strategy/comment";
    }

    @PostMapping("/updateState")
    @ResponseBody
    public Object  updateState(StrategyComment strategyComment){
        strategyCommentService.updateState(strategyComment);
        return new JsonResult();
    }


}
